/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.common.i;

import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.widget.TextView;
import android.widget.Toast;
import com.qihoo.gamecenter.sdk.common.b.a;
import java.lang.ref.WeakReference;

public class q {
    private static WeakReference a;

    public static void a(Context paramContext, String paramString, int paramInt1, int paramInt2) {
        c.a("ToastUtil", new Object[] { "Going to toast: ", paramString });
        if ((paramContext == null) || (TextUtils.isEmpty(paramString)))
            return;
        Toast localToast = null;
        if ((a == null) || ((localToast = (Toast) a.get()) == null) || (localToast.getView() == null)) {
            i = s.b(paramContext, 20.0F);
            TextView localTextView = new TextView(paramContext);
            localTextView.setTextColor(-12303292);
            localTextView.setBackgroundDrawable(a.a(paramContext, "360sdk_res/res1.dat", -1073741815));
            localTextView.setPadding(i, i, i, i);
            localTextView.setTextSize(1, s.a(paramContext, 13.3F));
            localToast = new Toast(paramContext);
            localToast.setView(localTextView);
            a = new WeakReference(localToast);
        }
        if (localToast == null)
            return;
        int i = 0;
        if (paramInt2 == 48)
            i = s.b(paramContext, 80.0F);
        else if (paramInt2 == 80)
            i = paramContext.getResources().getDisplayMetrics().heightPixels / 5;
        localToast.setGravity(paramInt2, 0, i);
        if (localToast.getView() != null)
            ((TextView) localToast.getView()).setText(paramString);
        localToast.setDuration(paramInt1);
        localToast.show();
    }

    public static void a(Context paramContext, String paramString) {
        a(paramContext, paramString, 0);
    }

    public static void a(Context paramContext, String paramString, int paramInt) {
        a(paramContext, paramString, paramInt, 80);
    }

    public static void b(Context paramContext, String paramString, int paramInt) {
        a(paramContext, paramString, 0, paramInt);
    }
}